package com.crm.crm.controller;
import com.crm.crm.annotation.Log;
import com.crm.crm.domain.dto.report.ContractStatisticsListDto;
import com.crm.crm.domain.vo.IndexTodayDataVo;
import com.crm.crm.domain.vo.BackLogVo;
import com.crm.crm.domain.vo.business.StatisticVo;
import com.crm.crm.domain.vo.business.result.Result;
import com.crm.crm.service.IndexService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
@Slf4j
public class IndexController {
    @Autowired
    private IndexService indexService;
    @GetMapping()
    public Result<BackLogVo> getBackLog(ContractStatisticsListDto dto){
        BackLogVo backLogVo = indexService.getBackLog(dto);
        return Result.success(backLogVo);
    }
    @Log("线索转化龙虎榜")
    @GetMapping("/salesStatistic")
    public Result<List<StatisticVo>> salesStatistic(ContractStatisticsListDto dto){
        List<StatisticVo> list = indexService.salesStatistic(dto);
        return Result.success(list);
    }
    @Log("商机转化龙虎榜")
    @GetMapping("/businessChangeStatistics")
    public Result<List<StatisticVo>> businessChangeStatistics(ContractStatisticsListDto dto){
        List<StatisticVo> list = indexService.businessChangeStatistics(dto);
        return Result.success(list);
    }
    @Log("今日简报")
    @GetMapping("/getTodayInfo")
    public Result<IndexTodayDataVo> getTodayInfo(){
        log.info("获取今日数据");
        IndexTodayDataVo indexTodayDataVo = indexService.getTodayInfo();
        return Result.success(indexTodayDataVo);
    }
}
